﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
          Random rd = new Random();


          int num2 = rd.Next(5);
          double num = num2 + rd.NextDouble() * (5 - num2);
          Console.WriteLine("生成0 - 5之间的随机小数，保留两位小数" + Math.Round(num, 2));


         double num3 = 4 + rd.NextDouble() * (5 - num2);
         Console.WriteLine("生成0 - 5之间的随机小数，保留两位小数" + Math.Round(num, 3));
        }
    }
}
